/**
 * 
 */
package cn.agiledata.bank.account.service;

import java.util.List;
import java.util.Map;

import cn.agiledata.bank.common.exception.BusinessException;
import cn.agiledata.bank.hibernateBean.Account;
import cn.agiledata.bank.hibernateBean.MoneyRole;
import cn.agiledata.bank.hibernateBean.QdTransDetail;
import cn.agiledata.bank.hibernateBean.SubAccount;
import cn.agiledata.bank.myspace.exception.MySpaceException;

import com.vnv.infrastructure.logic.IPBBaseMgr;

/**
 * 账户服务入口.
 * <p>
 * 用于与账户注册登陆修改维护等有关的行为
 * 
 * @author 马贤波
 * 
 * Mar 31, 2006
 */
public interface IAccountService extends IReturnCodeHolder, IPBBaseMgr,
		IAccountConst {

	/**
	 * 在AppContext中配置的ServiceBean的名称
	 */
	public static final String SERVICE_NAME = "accountService";

	/**
	 * 用户注册.
	 * 
	 * @param email
	 *            邮箱地址
	 * @param loginPassword
	 *            登录口令
	 * @param payPassword
	 *            支付口令
	 * @throws BusinessException
	 */

	/**
	 * 
	 * @param email
	 * @param accountId
	 * @throws BusinessException
	 */
	abstract public void sendActivateMailAfterRegister(String url,
			String email, Long accountId, String project)
			throws MySpaceException;

	abstract public void sendActivateMailAfterRegister(String email,
			Long accountId, String project) throws MySpaceException;

	abstract public void sendCancelMail(Map map) throws MySpaceException;

	abstract public void cancelMail(Map map) throws MySpaceException;

	abstract public void cancelMobile(Map map) throws MySpaceException;

	abstract public void sendActivateMailAfterRegister(Map map)
			throws MySpaceException;

	abstract public void resetLoginPassword(long accountId, String pass)
			throws MySpaceException;

	abstract public void sendResetPasswordCodeMail(String email, String pwdType)
			throws MySpaceException;

	abstract public Account findAccountByEmail(String email)
			throws BusinessException;
	
	abstract public QdTransDetail findDetailByOrderId(String orderId)
	throws BusinessException;
	
	abstract public List findTransHisByPara(long id,String startTime,String endTime)
	throws BusinessException;
	
	abstract public void saveOrUpdateTransDetail(QdTransDetail detail);

	abstract public Account findAccountByMobile(String email)
			throws BusinessException;

	abstract public SubAccount findSubAccountBalance(long accountId,
			String subAccountId);

	/**
	 * 获取指定子账户的所有银行
	 * 
	 * @param subaccountId
	 * @return List<BankInfo>
	 */
	abstract public List getBankBySubaccountId(long subaccountId)
			throws BusinessException;

	public abstract String userActivate(String email, String activeCode)
			throws MySpaceException;

	public abstract String userCancelToMob(Map form) throws MySpaceException;

	public abstract String userCancelToEmail(Map form) throws MySpaceException;

	public abstract String userActivateToMob(Map form) throws MySpaceException;

	public abstract void userLogout(AccountSummary user)
			throws BusinessException;

	public abstract void sendActivateMail(String url, String email,
			String project) throws MySpaceException;

	public abstract void sendPasswordMail(String email)
			throws BusinessException;

	// wap
	/**
	 * 用户登录.
	 * 
	 * @param from
	 *            来自(web,wap,call center,j2me)
	 * @param accountSign
	 *            用户标识，可能为：Email/Mobile/子账户名称
	 * @param operatorId
	 *            操作员id
	 * @param password
	 *            登录口令（区别于支付口令）
	 * @return 企业账户摘要
	 * @throws BusinessException
	 */
	abstract public AccountSummary userLogon(String from, Map map)
			throws BusinessException;
	/**
	 * 黑名单判断
	 * @param from
	 * @param map
	 * @return
	 * @throws BusinessException
	 */
	abstract public boolean checkBlackList(String email)
	throws BusinessException;



	/**
	 * 用户注册wap
	 * 
	 * @param loginPassword
	 * @param payPassword
	 * @param mobile
	 * @throws BusinessException
	 */
	abstract public void userRegisterByWap(String loginPassword,
			String payPassword, String mobile, String username)
			throws BusinessException;

	abstract public void userRegister(String from, String project, Map map)
			throws BusinessException;

	public Long getIntroductAccountId(String email) throws BusinessException;

	public boolean accountType(String email) throws BusinessException;

	public boolean lockAccount(Long accountId) throws BusinessException;

	public List getAccountBanksByAccountId(long accountId);

	/**
	 * 注册手机号码后，开通email,发激活信
	 */
	public void sendActivateMailAfterRegister(String email, String paypass,
			Long accountId) throws BusinessException;

	public Account findAccountByEmailAvaible(String sign)
			throws BusinessException;

	// 当支付密码输错时记入系统日志
	public void writeSystemLogWhenPayPasswordError(Account account, String ip);

	// 获取账户当日支付密码输错次数
	public int getCurrentPayPwdErrByAccountId(Long accountId);

	// 获取系统允许的当日支付密码累计输错次数上限(大于这个值就锁定该账户，明日才能登录)
	public int getMaxPayPwdErrFromSysBook();

	//锁定账户(明日才能登录)
	public void lockAccountLoginBySign(String emailOrMobile);
	
//	修改确认金额
	public String modifyAmount(Map form) throws MySpaceException;
    public Object statQdTransDetail(Long id,String ruleId)throws Exception;
    public List<MoneyRole> getRule()throws Exception;
    public void update(Account account)throws Exception;
}
